# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Justin Berthault <justin.berthault@zaclys.net>
pkgname=py3-codecov
pkgver=2.1.12
pkgrel=1
pkgdesc="Report uploader for Codecov"
options="!check" # Requires unpackaged 'ddt'
url="https://github.com/codecov/codecov-python"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-coverage py3-requests"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
source="$pkgname-$pkgver.tar.gz::https://github.com/codecov/codecov-python/archive/v$pkgver.tar.gz"
builddir="$srcdir"/codecov-python-$pkgver

replaces="py-codecov" # Backwards compatibility
provides="py-codecov=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	py.test-3 tests/test.py
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	local file; for file in "$pkgdir"/usr/bin/*; do
		mv $file $file-3
		ln -s "${file##*/}"-3 $file
	done
}

sha512sums="
fac34179ace4d4813ed71a5745e6ef8120d052fd7d7bef5548f80f7009f7b3242ec3aeb948f2125980ea932f130a2e81f742f47a3bd4f984726eaba16e1a7133  py3-codecov-2.1.12.tar.gz
"
